/**
 * 初始化病例操作日志详情对话框
 */
var SdsQcincaseOperlogInfoDlg = {
    validateFields: {
    	inCaseId: {
            validators: {
                notEmpty: {
                    message: '入组记录不能为空'
                }
            }
        },
    	operStateId: {
            validators: {
                notEmpty: {
                    message: '操作状态不能为空'
                }
            }
        },
    	operReason: {
            validators: {
                notEmpty: {
                    message: '操作依据不能为空'
                }
            }
        },
    	operResume: {
            validators: {
                notEmpty: {
                    message: '操作备注不能为空'
                }
            }
        },
    	operUserId: {
            validators: {
                notEmpty: {
                    message: '操作人不能为空'
                }
            }
        },
    	operDate: {
            validators: {
                notEmpty: {
                    message: '操作日期不能为空'
                }
            }
        },
    	operTime: {
            validators: {
                notEmpty: {
                    message: '操作时间不能为空'
                }
            }
        },
    }
};


/**
 * 关闭此对话框
 */
SdsQcincaseOperlogInfoDlg.close = function() {
    parent.layer.close(parent.layer.getFrameIndex(window.name)); //先得到当前iframe层的索引,再执行关闭   
}

/**
 * 验证数据是否为空
 */
SdsQcincaseOperlogInfoDlg.validate = function () {
    $('#sdsQcincaseOperlogInfoForm').data("bootstrapValidator").resetForm();
    $('#sdsQcincaseOperlogInfoForm').bootstrapValidator('validate');
    return $("#sdsQcincaseOperlogInfoForm").data('bootstrapValidator').isValid();
}

/**
 * 提交新增
 */
SdsQcincaseOperlogInfoDlg.addSubmit = function() {

    if (!this.validate()) {
        return;
    }
    //提交信息
    Sys.ajaxForm('sdsQcincaseOperlogInfoForm',Sys.backendPath + "/sds/sdsqcincaseoperlog/add",function(res) {
        Sys.success(res.message);
    	window.parent.SdsQcincaseOperlog.table.refresh();
        SdsQcincaseOperlogInfoDlg.close();
    });
}

/**
 * 提交修改
 */
SdsQcincaseOperlogInfoDlg.editSubmit = function() {

    if (!this.validate()) {
        return;
    }
    //提交信息
    Sys.ajaxForm('sdsQcincaseOperlogInfoForm',Sys.backendPath + "/sds/sdsqcincaseoperlog/update",function(res) {
        Sys.success(res.message);
    	window.parent.SdsQcincaseOperlog.table.refresh();
        SdsQcincaseOperlogInfoDlg.close();
    });
}

$(function() {
	Sys.initValidator("sdsQcincaseOperlogInfoForm", SdsQcincaseOperlogInfoDlg.validateFields);
});
